package com.hbx.constant;

import lombok.Getter;
import lombok.Setter;

/*
 * @Author:hbx
 * 
 * 用户类型枚举
 * */
public enum SexEnum {
    MAN(1,"男"),
    WEMAN(0,"女"),
    ;
    @Setter
    @Getter
    private Integer code;
    @Setter
    @Getter
    private String sex;

    SexEnum(Integer code, String sex) {
        this.code = code;
        this.sex = sex;
    }

    public static String getSex(Integer code){
        if (code == null){
            return null;
        }
        for (SexEnum typeEnum : SexEnum.values()) {
            if (typeEnum.getCode().equals(code)){
                return typeEnum.getSex();
            }
        }

        return null;
    }
}
